<%@page import="java.util.List"%>
<%@page import="com.webshopping.entry.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户查询页面</title>
<script type="text/javascript">
    function deleteUser(id){
    	var flag = confirm("确定删除么？");
    	if(flag){
    		window.open("<%=path%>/user/deleteUser.do?id="+id,"_self");
    	}    	
    }
    
    function updateUser(id){
    	     window.open("<%=path%>/user/getUser.do?id="+id,"_blank");
    }
    
    function addUser(){
    	window.open("<%=path%>/manager/user/userAdd.jsp","_blank");
    }
</script>

</head>
<body>
	<form action="QueryUser" method="post">

		<!-- 	<p>名称</p>
		<input type="text" id="goodsName" name="goodsName" />
		<p>类型</p>
		<select>
			<option>1</option>
			<option>2</option>
			<option>3</option>
		</select>
 -->
	</form>
	<table border="1px">
		<tr>
			<td>编号</td>
			<th>姓名</th>
			<th>密码</th>
			<th>身份</th>
			<th>性别</th>
			<th>操作</th>
		</tr>
		<c:forEach items="${requestScope.queryUsers}" var="user">
			<tr>
				<td>${user.id}</td>
				<td>${user.userName}</td>
				<td>${user.password}</td>
				<td>${user.attribute}</td>
				<td>${user.sex}</td>
				<th><input type="button" value="删除"
				onclick="deleteUser(${user.id})"> <input type="button"
				value="修改" onclick="updateUser(${user.id})"></th>
			</tr>

		</c:forEach>
		
		<tr>
			<td colspan="6"><input type="button" value="添加新用户"
				onclick="addUser()" /></td>
		</tr>
	</table>
</body>
</html>